/* =========================================================================
 *
 * Components.js
 *  This contains all components for the tutorial (ideally, components would
 *  each live in their own module)
 *
 *  Components are just data. 
 *
 * ========================================================================= */

// Image 
// --------------------------------------
ECS.Components.Image = function ComponentAppearance ( imgURL ){
    // Image specifies that a image url can be used to represent the appearance
    if (imgURL == null) {
    	console.log("** ERROR - Must give a image URL ");
    	return null;
    }

    this.imageURL = imgURL;
    this.image    = new Image();
    this.image.src= this.imageURL

    return this;
};

ECS.Components.Image.prototype.print = function print() {
	console.log("        imageURL : " + this.imageURL);
}

ECS.Components.Image.prototype.name = 'Image';

//Position
//--------------------------------------
ECS.Components.Position = function ComponentPosition ( params ){
 params = params || {};

 // Set to zero if not passed in
 this.x = params.x || 0;
 this.y = params.y || 0;

 return this;
};

ECS.Components.Position.prototype.print = function print() {
	console.log("        x : " + this.x);
	console.log("        y : " + this.y);
}

ECS.Components.Position.prototype.name = 'Position';